// 1.引入 mongodb 驱动包
const mongoose = require("mongodb");
const MongoClient = mongoose.MongoClient;

// 2.创建mongodb 客户端实例
// new MongoClient('mongodb://localhost:27017', {useNewUrlParser: true, useUnifiedTopology: true})
const mongoClient = new MongoClient("mongodb://localhost:27017");

// 3.连接数据库
mongoClient.connect();

// 4.指定访问哪个数据库 friends
// const db = mongoClient.db(数据库名字);
const db = mongoClient.db("friends");

// 5.导出 db
module.exports = db;
